<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>物联卡套餐管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
			$("#name").focus();
			$("#inputForm").validate({
				rules: {
					salePrice: {
						remote: "${ctx}/recharge/package/isPriceCompare?hPrice="+ encodeURIComponent('${p.salePrice}')}
				},
				messages: {
					salePrice: {remote: "销售价格必须大于单价"},
				},
				submitHandler: function(form){
					loading('正在提交，请稍等...');
					form.submit();
				},
				errorContainer: "#messageBox",
				errorPlacement: function(error, element) {
					$("#messageBox").text("输入有误，请先更正。");
					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
						error.appendTo(element.parent().parent());
					} else {
						error.insertAfter(element);
					}
				}
			});
		});
		
		function obtainPrice(){
			var prices = $("#price").val();
			price = prices;
		}
		console.log('${dictList[0].value}');
	</script>
</head>
<body>
	<ul class="nav nav-tabs">
	<li>
		<shiro:hasPermission name="recharge:package:list">
			<a href="${ctx}/recharge/package/list">物联卡套餐列表</a>
		</shiro:hasPermission>
	</li>
	<li class="active">
		<shiro:hasPermission name="recharge:package:save">
			<a href="${ctx}/recharge/package/openSave">物联卡套餐增加</a>
		</shiro:hasPermission>
	</li>
</ul><br/>
	<form:form id="inputForm" modelAttribute="package" action="${ctx}/recharge/package/save" method="post" class="form-horizontal">
		<form:hidden path="id"/>
		<sys:message content="${message}"/>		
		<div class="control-group">
			<label class="control-label">流量：</label>
			<div class="controls">
				<form:input path="type" htmlEscape="false" maxlength="48" class="input-xlarge required"/>
				<span class="help-inline"><font color="red">*</font> </span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">价格：</label>
			<div class="controls">
				<form:input id="price" onkeyup="obtainPrice()" path="price" htmlEscape="false" number="3,2" class="input-xlarge  number required"/>
				<span class="help-inline"><font color="red">*</font> </span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">套餐类型：</label>
			<div class="controls">
				<select id="tcId" name="tcId" class="input-xlarge required">
					<c:forEach items="${dictList}" var="list">
						<option value="${list.value}">${list.label}</option>
					</c:forEach>
				</select>
				<span class="help-inline"><font color="red">*</font> </span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">流量名称：</label>
			<div class="controls">
				<form:input path="tctype" htmlEscape="false" maxlength="48" class="input-xlarge required"/>
				<span class="help-inline"><font color="red">*</font> </span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">销售单价：</label>
			<div class="controls">
				<form:input  path="salePrice" number="3,2" htmlEscape="false" class="input-xlarge  number required"/>
				<input type="hidden" id="hPrice" name="hPrice" value="${p.price}">
				<span class="help-inline"><font color="red">*</font> </span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">备注信息：</label>
			<div class="controls">
				<form:textarea path="remarks" htmlEscape="false" rows="4" maxlength="255" class="input-xxlarge "/>
			</div>
		</div>
		<div class="form-actions">
			<shiro:hasPermission name="recharge:package:save">
				<input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"/>&nbsp;
			</shiro:hasPermission>
			<input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
		</div>
	</form:form>
</body>
</html>